/*
 * @author: sanbao
 * @Date: 2022-07-23 21:34:08
 */
import request from "@/utils/request";
/**
 * 数据
 * @returns 
 */
const getroleslist = () => {
    // http://47.108.251.106:8881/api/private/v1/roles
    return request({
        url: 'roles',
        method: 'GET',
    })
}
/**
 * 删除
 * @param id 
 * @returns 
 */
const deleteroleslist = (id: number) => {
    return request({
        url: `roles/${id}`,
        method: 'DELETE',
    })
}
/**
 * 添加
 * @param data 
 * @returns 
 */
const addroleslist = (data: object) => {
    return request({
        url: 'roles',
        method: 'POST',
        data
    })
}
/**
 * 修改数据
 * @param id 
 * @param data 
 * @returns 
 */
const editroleslist = (id: number, data: object) => {
    return request({
        url: `roles/${id}`,
        method: 'PUT',
        data
    })
}
/**
 * 单个数据查询
 * @param id 
 * @returns 
 */
const findroleslist = (id: number) => {
    // http://47.108.251.106:8881/api/private/v1/roles/193
    return request({
        url: `roles/${id}`,
        method: 'GET',
    })
}
/**
 * 分配角色删除
 * @param id 
 * @returns 
 */
const deleterightslist = (id: number) => {
    // http://47.108.251.106:8881/api/private/v1/roles/202/rights/153
    return request({
        url: `roles/202/rights/${id}`,
        method: 'DELETE',
    })
}
//
const getrightslist = () => {
    return request({
        // http://47.108.251.106:8881/api/private/v1/rights/tree
        url: 'rights/tree',
        method: 'GET',
    })
}
export default {
    getroleslist,
    deleteroleslist,
    addroleslist,
    findroleslist,
    editroleslist,
    deleterightslist,
    getrightslist
}